package com.caseprocessing.ai.vision;

import java.util.List;
import java.util.Map;

/**
 * 视觉分析结果模型集合
 * 定义各种视觉分析任务的结果数据结构
 */
public class VisionResultModels {
    
    /**
     * 文档结构分析结果
     */
    public static class DocumentStructureResult {
        private String rawAnalysis;
        private Map<String, RegionInfo> pageRegions;
        private List<ElementInfo> keyElements;
        private List<SplitIndicator> splitIndicators;
        private LayoutFeatures layoutFeatures;
        private double confidence;
        
        public DocumentStructureResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.confidence = 0.8; // 默认置信度
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public void setRawAnalysis(String rawAnalysis) { this.rawAnalysis = rawAnalysis; }
        
        public Map<String, RegionInfo> getPageRegions() { return pageRegions; }
        public void setPageRegions(Map<String, RegionInfo> pageRegions) { this.pageRegions = pageRegions; }
        
        public List<ElementInfo> getKeyElements() { return keyElements; }
        public void setKeyElements(List<ElementInfo> keyElements) { this.keyElements = keyElements; }
        
        public List<SplitIndicator> getSplitIndicators() { return splitIndicators; }
        public void setSplitIndicators(List<SplitIndicator> splitIndicators) { this.splitIndicators = splitIndicators; }
        
        public LayoutFeatures getLayoutFeatures() { return layoutFeatures; }
        public void setLayoutFeatures(LayoutFeatures layoutFeatures) { this.layoutFeatures = layoutFeatures; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
    }
    
    /**
     * 文档边界检测结果
     */
    public static class DocumentBoundaryResult {
        private String rawAnalysis;
        private List<SplitPoint> splitPoints;
        private List<PageTransition> pageTransitions;
        private AssessmentInfo overallAssessment;
        private double confidence;
        
        public DocumentBoundaryResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.confidence = 0.8;
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public List<SplitPoint> getSplitPoints() { return splitPoints; }
        public void setSplitPoints(List<SplitPoint> splitPoints) { this.splitPoints = splitPoints; }
        
        public List<PageTransition> getPageTransitions() { return pageTransitions; }
        public void setPageTransitions(List<PageTransition> pageTransitions) { this.pageTransitions = pageTransitions; }
        
        public AssessmentInfo getOverallAssessment() { return overallAssessment; }
        public void setOverallAssessment(AssessmentInfo overallAssessment) { this.overallAssessment = overallAssessment; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
    }
    
    /**
     * 文档类型识别结果
     */
    public static class DocumentTypeResult {
        private String rawAnalysis;
        private String documentType;
        private double confidence;
        private List<VisualEvidence> visualEvidence;
        private List<AlternativeType> alternativeTypes;
        private Map<String, String> keyVisualMarkers;
        
        public DocumentTypeResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.confidence = 0.8;
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public String getDocumentType() { return documentType; }
        public void setDocumentType(String documentType) { this.documentType = documentType; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
        
        public List<VisualEvidence> getVisualEvidence() { return visualEvidence; }
        public void setVisualEvidence(List<VisualEvidence> visualEvidence) { this.visualEvidence = visualEvidence; }
        
        public List<AlternativeType> getAlternativeTypes() { return alternativeTypes; }
        public void setAlternativeTypes(List<AlternativeType> alternativeTypes) { this.alternativeTypes = alternativeTypes; }
        
        public Map<String, String> getKeyVisualMarkers() { return keyVisualMarkers; }
        public void setKeyVisualMarkers(Map<String, String> keyVisualMarkers) { this.keyVisualMarkers = keyVisualMarkers; }
    }
    
    /**
     * 印章签名检测结果
     */
    public static class SealSignatureResult {
        private String rawAnalysis;
        private List<SealInfo> seals;
        private List<SignatureInfo> signatures;
        private ComplianceAssessment complianceAssessment;
        private QualitySummary qualitySummary;
        private double confidence;
        
        public SealSignatureResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.confidence = 0.8;
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public List<SealInfo> getSeals() { return seals; }
        public void setSeals(List<SealInfo> seals) { this.seals = seals; }
        
        public List<SignatureInfo> getSignatures() { return signatures; }
        public void setSignatures(List<SignatureInfo> signatures) { this.signatures = signatures; }
        
        public ComplianceAssessment getComplianceAssessment() { return complianceAssessment; }
        public void setComplianceAssessment(ComplianceAssessment complianceAssessment) { this.complianceAssessment = complianceAssessment; }
        
        public QualitySummary getQualitySummary() { return qualitySummary; }
        public void setQualitySummary(QualitySummary qualitySummary) { this.qualitySummary = qualitySummary; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
    }
    
    /**
     * 表格结构识别结果
     */
    public static class TableStructureResult {
        private String rawAnalysis;
        private List<TableInfo> tables;
        private List<TableRelationship> tableRelationships;
        private ExtractionQuality extractionQuality;
        private double confidence;
        
        public TableStructureResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.confidence = 0.8;
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public List<TableInfo> getTables() { return tables; }
        public void setTables(List<TableInfo> tables) { this.tables = tables; }
        
        public List<TableRelationship> getTableRelationships() { return tableRelationships; }
        public void setTableRelationships(List<TableRelationship> tableRelationships) { this.tableRelationships = tableRelationships; }
        
        public ExtractionQuality getExtractionQuality() { return extractionQuality; }
        public void setExtractionQuality(ExtractionQuality extractionQuality) { this.extractionQuality = extractionQuality; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
    }
    
    /**
     * 页面质量评估结果
     */
    public static class PageQualityResult {
        private String rawAnalysis;
        private double overallScore;
        private String qualityGrade;
        private Map<String, Double> detailedScores;
        private List<QualityIssue> issues;
        private List<Recommendation> recommendations;
        private UsabilityAssessment usabilityAssessment;
        
        public PageQualityResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.overallScore = 0.8;
            this.qualityGrade = "良好";
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public double getOverallScore() { return overallScore; }
        public void setOverallScore(double overallScore) { this.overallScore = overallScore; }
        
        public String getQualityGrade() { return qualityGrade; }
        public void setQualityGrade(String qualityGrade) { this.qualityGrade = qualityGrade; }
        
        public Map<String, Double> getDetailedScores() { return detailedScores; }
        public void setDetailedScores(Map<String, Double> detailedScores) { this.detailedScores = detailedScores; }
        
        public List<QualityIssue> getIssues() { return issues; }
        public void setIssues(List<QualityIssue> issues) { this.issues = issues; }
        
        public List<Recommendation> getRecommendations() { return recommendations; }
        public void setRecommendations(List<Recommendation> recommendations) { this.recommendations = recommendations; }
        
        public UsabilityAssessment getUsabilityAssessment() { return usabilityAssessment; }
        public void setUsabilityAssessment(UsabilityAssessment usabilityAssessment) { this.usabilityAssessment = usabilityAssessment; }
    }
    
    /**
     * 页面堆叠检测结果
     */
    public static class PageStackingResult {
        private String rawAnalysis;
        private boolean stackingDetected;
        private List<StackingDetail> stackingDetails;
        private ContentAnalysis contentAnalysis;
        private SequenceAnalysis sequenceAnalysis;
        private StackingRecommendations recommendations;
        private double confidence;
        
        public PageStackingResult(String rawAnalysis) {
            this.rawAnalysis = rawAnalysis;
            this.stackingDetected = false;
            this.confidence = 0.8;
        }
        
        // Getters and setters
        public String getRawAnalysis() { return rawAnalysis; }
        public boolean isStackingDetected() { return stackingDetected; }
        public void setStackingDetected(boolean stackingDetected) { this.stackingDetected = stackingDetected; }
        
        public List<StackingDetail> getStackingDetails() { return stackingDetails; }
        public void setStackingDetails(List<StackingDetail> stackingDetails) { this.stackingDetails = stackingDetails; }
        
        public ContentAnalysis getContentAnalysis() { return contentAnalysis; }
        public void setContentAnalysis(ContentAnalysis contentAnalysis) { this.contentAnalysis = contentAnalysis; }
        
        public SequenceAnalysis getSequenceAnalysis() { return sequenceAnalysis; }
        public void setSequenceAnalysis(SequenceAnalysis sequenceAnalysis) { this.sequenceAnalysis = sequenceAnalysis; }
        
        public StackingRecommendations getRecommendations() { return recommendations; }
        public void setRecommendations(StackingRecommendations recommendations) { this.recommendations = recommendations; }
        
        public double getConfidence() { return confidence; }
        public void setConfidence(double confidence) { this.confidence = confidence; }
    }
    
    /**
     * 综合视觉分析结果
     */
    public static class ComprehensiveVisionResult {
        private DocumentStructureResult structureResult;
        private DocumentBoundaryResult boundaryResult;
        private DocumentTypeResult typeResult;
        private SealSignatureResult sealSignatureResult;
        private PageQualityResult qualityResult;
        private double overallConfidence;
        private String analysisTimestamp;
        
        public ComprehensiveVisionResult(
                DocumentStructureResult structureResult,
                DocumentBoundaryResult boundaryResult,
                DocumentTypeResult typeResult,
                SealSignatureResult sealSignatureResult,
                PageQualityResult qualityResult) {
            this.structureResult = structureResult;
            this.boundaryResult = boundaryResult;
            this.typeResult = typeResult;
            this.sealSignatureResult = sealSignatureResult;
            this.qualityResult = qualityResult;
            this.overallConfidence = calculateOverallConfidence();
            this.analysisTimestamp = java.time.LocalDateTime.now().toString();
        }
        
        private double calculateOverallConfidence() {
            double total = 0.0;
            int count = 0;
            
            if (structureResult != null) { total += structureResult.getConfidence(); count++; }
            if (boundaryResult != null) { total += boundaryResult.getConfidence(); count++; }
            if (typeResult != null) { total += typeResult.getConfidence(); count++; }
            if (sealSignatureResult != null) { total += sealSignatureResult.getConfidence(); count++; }
            if (qualityResult != null) { total += qualityResult.getOverallScore(); count++; }
            
            return count > 0 ? total / count : 0.0;
        }
        
        // Getters and setters
        public DocumentStructureResult getStructureResult() { return structureResult; }
        public DocumentBoundaryResult getBoundaryResult() { return boundaryResult; }
        public DocumentTypeResult getTypeResult() { return typeResult; }
        public SealSignatureResult getSealSignatureResult() { return sealSignatureResult; }
        public PageQualityResult getQualityResult() { return qualityResult; }
        public double getOverallConfidence() { return overallConfidence; }
        public String getAnalysisTimestamp() { return analysisTimestamp; }
    }
    
    // ============ 辅助数据结构 ============
    
    public static class RegionInfo {
        private String position;
        private String contentType;
        private double confidence;
        
        public RegionInfo(String position, String contentType, double confidence) {
            this.position = position;
            this.contentType = contentType;
            this.confidence = confidence;
        }
        
        // Getters and setters
        public String getPosition() { return position; }
        public String getContentType() { return contentType; }
        public double getConfidence() { return confidence; }
    }
    
    public static class ElementInfo {
        private String type;
        private String position;
        private double confidence;
        
        public ElementInfo(String type, String position, double confidence) {
            this.type = type;
            this.position = position;
            this.confidence = confidence;
        }
        
        // Getters and setters
        public String getType() { return type; }
        public String getPosition() { return position; }
        public double getConfidence() { return confidence; }
    }
    
    public static class SplitIndicator {
        private int page;
        private String position;
        private String reason;
        private double confidence;
        
        public SplitIndicator(int page, String position, String reason, double confidence) {
            this.page = page;
            this.position = position;
            this.reason = reason;
            this.confidence = confidence;
        }
        
        // Getters and setters
        public int getPage() { return page; }
        public String getPosition() { return position; }
        public String getReason() { return reason; }
        public double getConfidence() { return confidence; }
    }
    
    public static class LayoutFeatures {
        private int columns;
        private int tables;
        private int lists;
        
        public LayoutFeatures(int columns, int tables, int lists) {
            this.columns = columns;
            this.tables = tables;
            this.lists = lists;
        }
        
        // Getters and setters
        public int getColumns() { return columns; }
        public int getTables() { return tables; }
        public int getLists() { return lists; }
    }
    
    public static class SplitPoint {
        private int pageNumber;
        private String position;
        private String splitType;
        private double confidence;
        private List<String> visualIndicators;
        private String reasoning;
        
        // Constructor and getters/setters
        public SplitPoint(int pageNumber, String position, String splitType, double confidence) {
            this.pageNumber = pageNumber;
            this.position = position;
            this.splitType = splitType;
            this.confidence = confidence;
        }
        
        public int getPageNumber() { return pageNumber; }
        public String getPosition() { return position; }
        public String getSplitType() { return splitType; }
        public double getConfidence() { return confidence; }
        public List<String> getVisualIndicators() { return visualIndicators; }
        public void setVisualIndicators(List<String> visualIndicators) { this.visualIndicators = visualIndicators; }
        public String getReasoning() { return reasoning; }
        public void setReasoning(String reasoning) { this.reasoning = reasoning; }
    }
    
    public static class PageTransition {
        private int fromPage;
        private int toPage;
        private String transitionType;
        private String strength;
        
        public PageTransition(int fromPage, int toPage, String transitionType, String strength) {
            this.fromPage = fromPage;
            this.toPage = toPage;
            this.transitionType = transitionType;
            this.strength = strength;
        }
        
        // Getters and setters
        public int getFromPage() { return fromPage; }
        public int getToPage() { return toPage; }
        public String getTransitionType() { return transitionType; }
        public String getStrength() { return strength; }
    }
    
    public static class AssessmentInfo {
        private String clarity;
        private String consistency;
        private List<String> recommendations;
        
        public AssessmentInfo(String clarity, String consistency, List<String> recommendations) {
            this.clarity = clarity;
            this.consistency = consistency;
            this.recommendations = recommendations;
        }
        
        // Getters and setters
        public String getClarity() { return clarity; }
        public String getConsistency() { return consistency; }
        public List<String> getRecommendations() { return recommendations; }
    }
    
    // 其他辅助类的定义...
    public static class VisualEvidence {
        private String feature;
        private String description;
        private double weight;
        
        public VisualEvidence(String feature, String description, double weight) {
            this.feature = feature;
            this.description = description;
            this.weight = weight;
        }
        
        // Getters and setters
        public String getFeature() { return feature; }
        public String getDescription() { return description; }
        public double getWeight() { return weight; }
    }
    
    public static class AlternativeType {
        private String type;
        private double confidence;
        private String reason;
        
        public AlternativeType(String type, double confidence, String reason) {
            this.type = type;
            this.confidence = confidence;
            this.reason = reason;
        }
        
        // Getters and setters
        public String getType() { return type; }
        public double getConfidence() { return confidence; }
        public String getReason() { return reason; }
    }
    
    public static class SealInfo {
        private String type;
        private String position;
        private double clarity;
        private double completeness;
        private String compliance;
        private boolean textReadable;
        private boolean colorNormal;
        
        // Constructor and getters/setters
        public SealInfo(String type, String position) {
            this.type = type;
            this.position = position;
        }
        
        public String getType() { return type; }
        public String getPosition() { return position; }
        public double getClarity() { return clarity; }
        public void setClarity(double clarity) { this.clarity = clarity; }
        public double getCompleteness() { return completeness; }
        public void setCompleteness(double completeness) { this.completeness = completeness; }
        public String getCompliance() { return compliance; }
        public void setCompliance(String compliance) { this.compliance = compliance; }
        public boolean isTextReadable() { return textReadable; }
        public void setTextReadable(boolean textReadable) { this.textReadable = textReadable; }
        public boolean isColorNormal() { return colorNormal; }
        public void setColorNormal(boolean colorNormal) { this.colorNormal = colorNormal; }
    }
    
    public static class SignatureInfo {
        private String type;
        private String position;
        private String legibility;
        private String completeness;
        private boolean datePresent;
        
        public SignatureInfo(String type, String position) {
            this.type = type;
            this.position = position;
        }
        
        // Getters and setters
        public String getType() { return type; }
        public String getPosition() { return position; }
        public String getLegibility() { return legibility; }
        public void setLegibility(String legibility) { this.legibility = legibility; }
        public String getCompleteness() { return completeness; }
        public void setCompleteness(String completeness) { this.completeness = completeness; }
        public boolean isDatePresent() { return datePresent; }
        public void setDatePresent(boolean datePresent) { this.datePresent = datePresent; }
    }
    
    public static class ComplianceAssessment {
        private String overallCompliance;
        private List<String> missingElements;
        private List<String> issues;
        private List<String> recommendations;
        
        public ComplianceAssessment(String overallCompliance) {
            this.overallCompliance = overallCompliance;
        }
        
        // Getters and setters
        public String getOverallCompliance() { return overallCompliance; }
        public List<String> getMissingElements() { return missingElements; }
        public void setMissingElements(List<String> missingElements) { this.missingElements = missingElements; }
        public List<String> getIssues() { return issues; }
        public void setIssues(List<String> issues) { this.issues = issues; }
        public List<String> getRecommendations() { return recommendations; }
        public void setRecommendations(List<String> recommendations) { this.recommendations = recommendations; }
    }
    
    public static class QualitySummary {
        private double sealQualityAvg;
        private double signatureQualityAvg;
        private int totalSeals;
        private int totalSignatures;
        
        public QualitySummary(double sealQualityAvg, double signatureQualityAvg, int totalSeals, int totalSignatures) {
            this.sealQualityAvg = sealQualityAvg;
            this.signatureQualityAvg = signatureQualityAvg;
            this.totalSeals = totalSeals;
            this.totalSignatures = totalSignatures;
        }
        
        // Getters and setters
        public double getSealQualityAvg() { return sealQualityAvg; }
        public double getSignatureQualityAvg() { return signatureQualityAvg; }
        public int getTotalSeals() { return totalSeals; }
        public int getTotalSignatures() { return totalSignatures; }
    }
    
    public static class TableInfo {
        private String tableId;
        private String position;
        private Map<String, Integer> dimensions;
        private List<String> headers;
        private String tableType;
        private List<String> dataTypes;
        private double completeness;
        private double readability;
        
        public TableInfo(String tableId, String position) {
            this.tableId = tableId;
            this.position = position;
        }
        
        // Getters and setters
        public String getTableId() { return tableId; }
        public String getPosition() { return position; }
        public Map<String, Integer> getDimensions() { return dimensions; }
        public void setDimensions(Map<String, Integer> dimensions) { this.dimensions = dimensions; }
        public List<String> getHeaders() { return headers; }
        public void setHeaders(List<String> headers) { this.headers = headers; }
        public String getTableType() { return tableType; }
        public void setTableType(String tableType) { this.tableType = tableType; }
        public List<String> getDataTypes() { return dataTypes; }
        public void setDataTypes(List<String> dataTypes) { this.dataTypes = dataTypes; }
        public double getCompleteness() { return completeness; }
        public void setCompleteness(double completeness) { this.completeness = completeness; }
        public double getReadability() { return readability; }
        public void setReadability(double readability) { this.readability = readability; }
    }
    
    public static class TableRelationship {
        private List<String> tables;
        private String relationship;
        private String description;
        
        public TableRelationship(List<String> tables, String relationship, String description) {
            this.tables = tables;
            this.relationship = relationship;
            this.description = description;
        }
        
        // Getters and setters
        public List<String> getTables() { return tables; }
        public String getRelationship() { return relationship; }
        public String getDescription() { return description; }
    }
    
    public static class ExtractionQuality {
        private String overallQuality;
        private List<String> issues;
        private String dataIntegrity;
        private String formatConsistency;
        
        public ExtractionQuality(String overallQuality) {
            this.overallQuality = overallQuality;
        }
        
        // Getters and setters
        public String getOverallQuality() { return overallQuality; }
        public List<String> getIssues() { return issues; }
        public void setIssues(List<String> issues) { this.issues = issues; }
        public String getDataIntegrity() { return dataIntegrity; }
        public void setDataIntegrity(String dataIntegrity) { this.dataIntegrity = dataIntegrity; }
        public String getFormatConsistency() { return formatConsistency; }
        public void setFormatConsistency(String formatConsistency) { this.formatConsistency = formatConsistency; }
    }
    
    public static class QualityIssue {
        private String type;
        private String severity;
        private String description;
        private String location;
        
        public QualityIssue(String type, String severity, String description, String location) {
            this.type = type;
            this.severity = severity;
            this.description = description;
            this.location = location;
        }
        
        // Getters and setters
        public String getType() { return type; }
        public String getSeverity() { return severity; }
        public String getDescription() { return description; }
        public String getLocation() { return location; }
    }
    
    public static class Recommendation {
        private String action;
        private String priority;
        private String description;
        
        public Recommendation(String action, String priority, String description) {
            this.action = action;
            this.priority = priority;
            this.description = description;
        }
        
        // Getters and setters
        public String getAction() { return action; }
        public String getPriority() { return priority; }
        public String getDescription() { return description; }
    }
    
    public static class UsabilityAssessment {
        private String ocrSuitability;
        private boolean manualReviewNeeded;
        private double processingConfidence;
        
        public UsabilityAssessment(String ocrSuitability, boolean manualReviewNeeded, double processingConfidence) {
            this.ocrSuitability = ocrSuitability;
            this.manualReviewNeeded = manualReviewNeeded;
            this.processingConfidence = processingConfidence;
        }
        
        // Getters and setters
        public String getOcrSuitability() { return ocrSuitability; }
        public boolean isManualReviewNeeded() { return manualReviewNeeded; }
        public double getProcessingConfidence() { return processingConfidence; }
    }
    
    public static class StackingDetail {
        private List<Integer> pageNumbers;
        private String stackingType;
        private String severity;
        private String description;
        private List<String> visualEvidence;
        private boolean separable;
        
        public StackingDetail(List<Integer> pageNumbers, String stackingType, String severity) {
            this.pageNumbers = pageNumbers;
            this.stackingType = stackingType;
            this.severity = severity;
        }
        
        // Getters and setters
        public List<Integer> getPageNumbers() { return pageNumbers; }
        public String getStackingType() { return stackingType; }
        public String getSeverity() { return severity; }
        public String getDescription() { return description; }
        public void setDescription(String description) { this.description = description; }
        public List<String> getVisualEvidence() { return visualEvidence; }
        public void setVisualEvidence(List<String> visualEvidence) { this.visualEvidence = visualEvidence; }
        public boolean isSeparable() { return separable; }
        public void setSeparable(boolean separable) { this.separable = separable; }
    }
    
    public static class ContentAnalysis {
        private List<DuplicateContent> duplicateContent;
        private List<DensityAnomaly> densityAnomalies;
        
        public ContentAnalysis(List<DuplicateContent> duplicateContent, List<DensityAnomaly> densityAnomalies) {
            this.duplicateContent = duplicateContent;
            this.densityAnomalies = densityAnomalies;
        }
        
        // Getters and setters
        public List<DuplicateContent> getDuplicateContent() { return duplicateContent; }
        public List<DensityAnomaly> getDensityAnomalies() { return densityAnomalies; }
    }
    
    public static class DuplicateContent {
        private String content;
        private List<Integer> pages;
        private double similarity;
        
        public DuplicateContent(String content, List<Integer> pages, double similarity) {
            this.content = content;
            this.pages = pages;
            this.similarity = similarity;
        }
        
        // Getters and setters
        public String getContent() { return content; }
        public List<Integer> getPages() { return pages; }
        public double getSimilarity() { return similarity; }
    }
    
    public static class DensityAnomaly {
        private int page;
        private String region;
        private double densityScore;
        private String anomalyType;
        
        public DensityAnomaly(int page, String region, double densityScore, String anomalyType) {
            this.page = page;
            this.region = region;
            this.densityScore = densityScore;
            this.anomalyType = anomalyType;
        }
        
        // Getters and setters
        public int getPage() { return page; }
        public String getRegion() { return region; }
        public double getDensityScore() { return densityScore; }
        public String getAnomalyType() { return anomalyType; }
    }
    
    public static class SequenceAnalysis {
        private String logicalOrder;
        private String pageNumbering;
        private String contentFlow;
        
        public SequenceAnalysis(String logicalOrder, String pageNumbering, String contentFlow) {
            this.logicalOrder = logicalOrder;
            this.pageNumbering = pageNumbering;
            this.contentFlow = contentFlow;
        }
        
        // Getters and setters
        public String getLogicalOrder() { return logicalOrder; }
        public String getPageNumbering() { return pageNumbering; }
        public String getContentFlow() { return contentFlow; }
    }
    
    public static class StackingRecommendations {
        private List<String> immediateActions;
        private String separationStrategy;
        private String qualityRecovery;
        private List<String> preventionMeasures;
        
        public StackingRecommendations(List<String> immediateActions, String separationStrategy) {
            this.immediateActions = immediateActions;
            this.separationStrategy = separationStrategy;
        }
        
        // Getters and setters
        public List<String> getImmediateActions() { return immediateActions; }
        public String getSeparationStrategy() { return separationStrategy; }
        public String getQualityRecovery() { return qualityRecovery; }
        public void setQualityRecovery(String qualityRecovery) { this.qualityRecovery = qualityRecovery; }
        public List<String> getPreventionMeasures() { return preventionMeasures; }
        public void setPreventionMeasures(List<String> preventionMeasures) { this.preventionMeasures = preventionMeasures; }
    }
}